<ul id="sub-nav" class="moomenu dropdown wrap navHover">
		{assign var=startdepth value=0}
		{assign var=first_menu value=1}
		{foreach name="children" key=key from=$sections item=section}
		{assign var=nextkey value=`$key+1`}
		{assign var=previouskey value=`$key-1`}

		{if $sections[$previouskey]->depth < $section->depth && $smarty.foreach.children.first!=true}
		<ul class="nav-content">
		{/if}

		{if $section->active == 1}
			<li {if $first_menu==1}class="first" {assign var=first_menu value=0}{/if}>
			<a href="{$section->link}" {if $section->new_window ==1}target=_blank{/if}>{$section->name}</a>
			{if $sections[$nextkey]->depth == $section->depth}</li>{/if}
		{else }
			<li>
				<a href="#">{$section->name}</a>
			{if $sections[$nextkey]->depth == $section->depth}</li>{/if}
		{/if}

		{if $sections[$nextkey]->depth < $section->depth}
			{if $smarty.foreach.children.last==true}
				{assign var=nextdepth value=$startdepth}
			{else}
				{assign var=nextdepth value=$sections[$nextkey]->depth}
			{/if}
			{math equation="x-y" x=$section->depth y=$nextdepth assign=looper}
			{section name="close" loop=$looper}
						</li>
					</ul>

			{/section}
				</li>
		{/if}

		{/foreach}
	</ul>
